package com.prime.tutorial.moviestore.service.logistics;

import com.prime.tutorial.moviestore.domain.Device;
import com.prime.tutorial.moviestore.domain.Model;
import com.prime.tutorial.moviestore.domain.State;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Provides services for logistics department view<br/>
 * Created by IntelliJ IDEA.<br/>
 * Date: 1 бер 2010  <br/>
 * Time: 8:25:30 <br/>
 * @author iryna.masyuk
 * @author vasylja
 */
public interface LogisticsService {
    /**
     * Returns all available models
     * @return list of models
     */
    public List<Model> getDeviceModels();

    /**
     * Used to resolve the result of user's select of model
     * @param modelName - the name of the selected model
     * @return Model
     */
    public Model findModel(String modelName);

    /**
     * Used to find state by name
     * @param stateName name of the state
     * @return State
     */
    public State findState(String stateName);

    /**
     * returns all the devices on storage
     * @return list of devices
     */
    public List<Device> getDevicesOnStorage();

    /**
     * Returns all the devices with STATE_PLANNED_INSTALLATION
     * @return list of devices
     */
    public List<Device> getDevicesPlannedInstallation();
    /**
     * Returns all the devices with STATE_AVAILABLE_INSTALLATION
     * @return list of devices
     */
    public List<Device> getDevicesAvailableInstallation();

    /**
     * Maps devices with STATE_PLANNED_INSTALLATION to available devices on storage
     */
    @Transactional
    public void updateApproved();
    /**
     * Changes the status of the device to Approved
     * @param d device, which status we're trying to change
     */
    @Transactional
    public void setApproved(Device d);

    /**
     * Creates new device on storage(i.e. with STATE_ON_STORAGE)
     * @param device device to create
     */
    @Transactional
    public void createDevice(Device device);

    /**
     * Removes device from storage
     * @param device device to remove
     */
    @Transactional
    public void deleteDevice(Device device);
}
